<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ page import="controller.DBmanager, model.BidDAO, model.AuctionDAO, model.AuctionBean, java.util.ArrayList;"%>
<% 
	response.setHeader("Cache-Control","no-cache"); //http 1.0
	response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate");//http 1.1
	response.setHeader("Pragma","no-cache"); 
	response.setHeader("Expires", "01 Apr 1995 01:10:10 GMT"); 
	DBmanager man = DBmanager.getInstance(getServletContext());
	int x = new Integer(session.getAttribute("userid").toString());
	ArrayList<AuctionBean> auctions = new AuctionDAO().selectAuctionsFromOwner(x);
	int id=0;
	for(AuctionBean bean: auctions){ %>
	<div id="auction">
		<table class="main" id="auctiontable">
			<tr>
				<td class="main" colspan="2"><a href="#" onclick="changeContent('viewAuction.jsp?id=<%= bean.getID() %>')"><%= bean.getName() %></a></td>
			</tr>
			<tr>
				<td class="main"><a href="#" onclick="changeContent('viewAuction.jsp?id=<%= bean.getID() %>')"><img src="img/thumbs/<%= bean.getPic() %>" border="0"/></a></td>
				<td class="main">
					<form action="servlet" method="post">
						<input type="hidden" name="auctionid" value="<%= bean.getID() %>" />						
						<input type="submit" class="g-button g-button-submit" name="button" value="Delete Auction"/>
					</form>
				</td>
			</tr>
			<tr>
				<% id++; %>
				<td class="main">Auction timer</td>
				<td class="main">Highest bid</td>
			</tr>
			<tr>
				<td class="main" id=<%= "timer" + id %>>0</td>
				<td class="main" id=<%= "price" + id %>></td>
			</tr>
		</table>
	</div>
	<script type="text/javascript">initTimer('timer<%=id %>','<%= bean.getEnd() %>');</script>
	<script type="text/javascript">
	var z = highest("<%= new BidDAO().getMaxBid(bean.getID()) %>","<%= bean.getPrice() %>");
	document.getElementById("<%= "price" + id %>").innerHTML = "&euro;" + z;
	</script>
<% } %>